#include <bits/stdc++.h>
using namespace std;
int n;
int f[2000000];
vector<int> e[2000000];
void dfs(int x)
{
    for (int y : e[x])
    {
        if (y != f[x])
        {
            f[y] = x;
            dfs(y);
        }
    }
}
void find(int x)
{
    if (f[x])
    {
        find(f[x]);
        printf("%d ", x);
        f[x] = 0;
    }
}
void read(int &x)
{
    char c = getchar();
    while (!isdigit(c))
    {
        c = getchar();
    }
    x = 0;
    while (isdigit(c))
    {
        x = x * 10 + c - '0';
        c = getchar();
    }
}
int main()
{
    freopen("choice.in", "r", stdin);
    freopen("choice.out", "w", stdout);
    read(n);
    for (int i = 1, x, y; i < n; i++)
    {
        read(x);
        read(y);
        e[x].push_back(y);
        e[y].push_back(x);
    }
    dfs(1);
    printf("1 ");
    for (int i = 1; i <= n; i++)
    {
        find(i);
    }
    return 0;
}